﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using posttracker.Classes;
using System.Web.Security;
namespace posttracker.Account
{
    public partial class CLoginUser : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void LoginingUser(object sender, EventArgs e)
        {

            //string password = "";
            
           

            //using (SqlConnection conn = new SqlConnection("Data Source=G74-PC\\SQLEXPRESS;Initial Catalog=posttrackerApi2.Models.posttracker_db;Integrated Security=True"))
            //{
            //    conn.Open();
            //    //SqlCommand command = new SqlCommand("Select UserName, Password From Users where UserName ='" + LoginUser.UserName + @"'", conn);

            //    SqlDataReader reader = command.ExecuteReader();
            //    if (reader.Read())
            //    {
            //        password = (string)reader["Password"];
            //    }
            //    conn.Close();


            //}
            

            //if (password == LoginUser.Password)
            //{
            //    formsauthentication.setauthcookie(loginuser.username, false /* createpersistentcookie */);
            //    loginuser.instructiontext = string.empty;

            //    string continueurl = "~/";

            //    response.redirect(continueurl);

            //}


            //User user = new User() { UserName = LoginUser.UserName, Password = FormsAuthentication.HashPasswordForStoringInConfigFile(LoginUser.Password, "MD5") };

            //bool result = Registration.AuthenticateUser(user);
            


        }

       
    }
}